package demo10.对象的打印;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 姚东名
 * Date: 2024-06-13
 * Time: 15:27
 */
public class Person1 {
    String name;
    String gender;
    int age;

    public Person1(String name, String gender, int age) {
        this.name = name;
        this.gender = gender;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person1{" +
                "name='" + name + '\'' +
                ", gender='" + gender + '\'' +
                ", age=" + age +
                '}';
    }

    public static void main(String[] args) {
        Person1 person1 = new Person1("zhangsan", "男", 19);
        System.out.println(person1);
    }
}

//输出结果
//Person1{name='zhangsan', gender='男', age=19}